/*
 * Copyright (c) 2025 Industrial Software Feature Database
 */
package com.comac.ins.test;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@SpringBootTest
public class DirectoryStructureTest {

    @Test
    void printDirectoryStructure() throws Exception {
        Path rootPath = Paths.get("D:\\要素库项目\\二期\\参数化建模平台对接需求\\型材库源码\\comacins-isfd");
        printStructure(rootPath, 0);
    }

    private void printStructure(Path path, int depth) throws Exception {
        File[] files = path.toFile().listFiles();
        if (files == null) return;

        for (File file : files) {
            if (file.isDirectory()) {
                System.out.println("\t".repeat(depth) + file.getName());
                printStructure(file.toPath(), depth + 1);
            }
        }

        // 打印根目录下的文件
        for (File file : files) {
            if (file.isFile()) {
                System.out.println("\t".repeat(depth) + file.getName());
            }
        }
    }
}
